//    Copyright (C) Kherty.  All rights reserved.
using System;

namespace OpenLS.Spreadsheet.AnalysisToolPak
{
    internal abstract class ConstantDateBasis : DateBasis
    {
        protected abstract int DaysInYearImp { get; }
        public override sealed int DaysInYear(DateTime? dt)
        {
            return DaysInYearImp;
        }



        internal override double YearDifference(DateTime d1, DateTime d2)
        {
            double days = DayDifferenceImp(d1, d2);
            return days/(double) DaysInYearImp;
        }

        internal override double CoupDays(DateTime settlement, DateTime maturity, Frequency frequency)
        {
            return ((double) DaysInYearImp)/(int) (frequency);
        }
    }
}